// next_permutation example
#include <iostream>     // std::cout
#include <algorithm>    // std::next_permutation, std::sort

int main () {
  int myints[] = {0,1,2,3,4,5,6,7,8,9};

  std::sort (myints,myints+10);

  for (int i = 0; i < 1000000-1; i++) {
	std::next_permutation(myints,myints+10);
  }	
//  std::cout << "The 3! possible permutations with 3 elements:\n";
//  do {
  //  std::cout << myints[0] << ' ' << myints[1] << ' ' << myints[2] << '\n';
  //} while ( std::next_permutation(myints,myints+3) );

  for (int i = 0; i < 10; i++) {
  	std::cout << myints[i];
  }
  std::cout << std::endl;
  

  return 0;
}
